package com.zz.bid.mapper;

import com.zz.bid.pojo.to.SettleFlowDetails;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SettleFlowMapper {
    @Select("select settleId,flowId,lastUpdateTime,lastUpdateUser,approved from op_settle_flow where settleId = #{settleId} ")
    List<SettleFlowDetails> getSettleFlows(@Param("settleId") Integer settle);

    @Select("select settleId,flowId,lastUpdateTime,lastUpdateUser,approved from op_settle_flow where settleId = #{settleId} and flowId=#{flowId}")
    SettleFlowDetails getSettleFlow(@Param("settleId") Integer settle, @Param("flowId") Integer flowId);

    @Insert("insert into op_settle_flow(settleId,flowId,lastUpdateTime,lastUpdateUser,approved) " +
            "values(#{flowDetails.settleId},#{flowDetails.flowId},#{flowDetails.lastUpdateTime},#{flowDetails.lastUpdateUser},#{flowDetails.approved})")
    void insert(@Param("flowDetails") SettleFlowDetails settleFlowDetails);

    @Update("update op_settle_flow set lastUpdateTime = #{flowDetails.lastUpdateTime},lastUpdateUser = #{flowDetails.lastUpdateUser},approved=#{flowDetails.approved} " +
            "where settleId = #{flowDetails.settleId} and flowId = #{flowDetails.flowId} ")
    void update(@Param("flowDetails") SettleFlowDetails settleFlowDetails);
}
